//
// Created by 33145 on 2023/4/3.
//

#ifndef SYLAR_CHAT_SERVER_H
#define SYLAR_CHAT_SERVER_H

#include "sylar/http/ws_server.h"
#include "sylar/chat/resource_servlet.h"
#include "sylar/chat/chat_servlet.h"
#include "sylar/chat/protocol.h"

namespace chat {
class ChatServer : public sylar::TcpServer {
  public:
    typedef std::shared_ptr<ChatServer> ptr;

    ChatServer(sylar::IOManager* worker = sylar::IOManager::GetThis()
    , sylar::IOManager* io_worker = sylar::IOManager::GetThis()
    , sylar::IOManager* accept_worker = sylar::IOManager::GetThis());
  ChatWSServlet::ptr getChatWSServlet() { return m_servlet; }
  void setChatWSServlet(ChatWSServlet::ptr v) { m_servlet = v; }
  protected:
    void handleClient(sylar::Socket::ptr client) override;
  protected:
    ChatWSServlet::ptr m_servlet;
  };

}

#endif //SYLAR_CHAT_SERVER_H
